<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>流程实例执行历史列表</title>
	<#include "/common/resource.ftl">
</head>
<body>

<div class="ui-operation">
    <div class="ui-search-items layui-form">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">标题</label>
                <div class="layui-input-inline">
                    <input type="text" name="title" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">发起人</label>
                <div class="layui-input-inline">
                    <input type="text" name="instanceCreateName" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-inline">
                    <select name="status" class="layui-input">
                        <option value="">请选择</option>
                        <option value="1">审批中</option>
                        <option value="2">已通过</option>
                        <option value="3">已驳回</option>
                    </select>
                </div>
            </div>
            <#--end-->
        </div>
    </div>
    <div class="ui-buttons">
        <#--<div class="layui-btn-group tools">
            <@auth code='workflowHistory_add'><button class="layui-btn layui-btn-normal open-dialog" p="url:'${params.contextPath}/view/business/workflowHistory/workflowHistory_edit.htm',title:'添加流程实例执行历史',width:'600px',height:'400px'"><i class="fa fa-plus"></i>添加</button></@auth>
            <@auth code='workflowHistory_update'><button class="layui-btn layui-btn-normal singleSelected" p="url:'${params.contextPath}/view/business/workflowHistory/workflowHistory_edit.htm',title:'编辑流程实例执行历史',width:'600px',height:'400px'"><i class="fa fa-pencil"></i>修改</button></@auth>
            <@auth code='workflowHistory_delete'><button class="layui-btn layui-btn-normal remove-button" reurl="${params.contextPath}/web/workflowHistory/delete.json"><i class="fa fa-remove"></i>删除</button></@auth>
        </div>-->
        <div class="ui-searchs">
            <input type="button" value="搜索" class="layui-btn layui-btn-danger search-button"/>
        </div>
    </div>
</div>
<div class="ui-content" style="padding-left: 10px;padding-right:10px;">
    <table id="datagrid" options="url:'${params.contextPath}/web/workflowHistory/list',params:'getSearchParams',dblClickRow:'showDetail'">
        <thead>
			<tr>
				<th data-options="field:'id',checkbox:true"></th>
                <th data-options="field:'instanceTitle',width:200,align:'left'">标题</th>
                <th data-options="field:'instanceCreateName',width:150,align:'left'">发起人</th>
                <th data-options="field:'stepName',width:150,align:'left'">审批环节</th>
                <th data-options="field:'statusStr',width:100,align:'left',formatter:formatState">审批状态</th>
                <th data-options="field:'modifyTimeStr',width:200,align:'left'">审批开始时间</th>
                <th data-options="field:'createTimeStr',width:200,align:'left'">审批结束时间</th>
			</tr>
        </thead>
    </table>
</div>
<script type="text/javascript">
    function getSearchParams() {
        return {
            title: $("input[name='title']").val(),
            instanceCreateName: $("input[name='instanceCreateName']").val(),
            status: $("select[name='status']").val()
        };
    }
    var showDetail = function (index, row) {
        <@auth code='workflowHistory_detail'>
            var url = "${params.contextPath}" + row.defineFormPath + "_detail?his=1&id=" + row.instanceFormId + "&formId=" + row.instanceFormId;
            DialogManager.openDialog("url:'" + url + "',title:'流程实例执行历史详情',width:'80%',height:'100%'");
        </@auth>
    };
    //formatter:formatState
    function formatState(row) {
        if (row.status == 2) {
            return '<span class="ui-accept">' + row.statusStr + '</span>';
        } else if (row.status == 3) {
            return '<span class="ui-stop">' + row.statusStr + '</span>';
        }
        return row.statusStr;
    }
</script>
</body>

</html>
